Skip to content

feat(ingest/powerbi): resolve Fabric SQL endpoints to OneLake lineage - #20884

Open
brock-acryl wants to merge 12 commits into
feat/powerbi-dataflow-gen2-lineagefrom
feat/powerbi-warehouse-endpoint-lineage
Open

brock-acryl wants to merge 12 commits into
feat/powerbi-dataflow-gen2-lineagefrom
feat/powerbi-warehouse-endpoint-lineage

Conversation

@brock-acryl

@brock-acryl brock-acryl commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • A table (or Dataflow Gen2 entity) whose M query reads a Fabric Lakehouse or Warehouse through Sql.Database("<endpoint>.datawarehouse.fabric.microsoft.com", …), including native [Query=…] SQL, now gets its upstream on the OneLake table the OneLake connector emits, instead of a generic mssql dataset no connector produces. Applies in both metadata modes.
  • Endpoints that cannot be matched to a Lakehouse or Warehouse of the same workspace, or whose display name is ambiguous, keep the mssql edge and are warned. Unsupported shapes (Sql.Databases, navigation without Item) are warned.
  • Swapped OneLake edges are not subject to the deprecated dataset_type_mapping, same as DirectLake lineage.
  • Datamart, MirroredDatabase and SQLDatabase endpoints are left out because the OneLake connector does not emit those items.

Breaking change

The mssql upstream edges of Fabric SQL-endpoint queries move to OneLake. URN casing matches when OneLake runs with convert_urns_to_lowercase: true or Power BI with convert_lineage_urns_to_lowercase: false. See docs/how/breaking-changes.md.

Stack

Part of a stack built on #20842 (Power BI metadata_api_mode: workspace_apis). Merge order:
#20876 → #20877 → #20878 → #20879 → #20880 → #20881 → #20882 → #20883 → #20884 → #20885.
Review this PR's own diff against its base branch; each layer is self-contained and tested on its own.

Checklist

  • PR title follows the Conventional Commits format
  • Tests added/updated (unit and integration goldens)
  • Docs updated (metadata-ingestion/docs/sources/powerbi/)
  • Breaking change documented in docs/how/breaking-changes.md

🤖 Generated with Claude Code

@codecov

codecov Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.52239% with 6 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...on/src/datahub/ingestion/source/powerbi/powerbi.py 94.80% 4 Missing ⚠️
...ngestion/source/powerbi/m_query/pattern_handler.py 94.73% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@brock-acryl
brock-acryl force-pushed the feat/powerbi-warehouse-endpoint-lineage branch 2 times, most recently from b42323f to e82814e Compare December 2, 2026 20:40
@brock-acryl
brock-acryl force-pushed the feat/powerbi-warehouse-endpoint-lineage branch from e82814e to 3191f8f Compare December 2, 2026 20:51
@brock-acryl
brock-acryl force-pushed the feat/powerbi-warehouse-endpoint-lineage branch from 3191f8f to f450158 Compare December 2, 2026 21:01
@brock-acryl
brock-acryl force-pushed the feat/powerbi-warehouse-endpoint-lineage branch from f450158 to fba44bb Compare December 3, 2026 11:14
brock-acryl and others added 6 commits December 4, 2026 14:35
…ke lineage

In workspace_apis mode a semantic-model table that reads a Fabric SQL
analytics endpoint through `Sql.Database("<host>.datawarehouse.fabric.
microsoft.com", ...)` got a generic mssql upstream, and only lakehouse
endpoints were counted or reported. Now:

- Warehouse items are counted as their own SQL endpoint
  (`fabric_warehouse_endpoints_registered`); a warehouse id is its endpoint
  id, so the existing Warehouse artifact already resolves DirectLake
  partitions over it. Lakehouse endpoints get a matching counter.
- MSSqlLineage attaches a FabricSqlEndpointReference when the server is a
  Fabric endpoint host; the mapper swaps the mssql edge (and its column
  lineage) for the OneLake table behind the endpoint, matched by endpoint
  id or item display name against the workspace's Fabric items, with
  platform_instance/env from server_to_platform_instance keyed by
  workspace id. An endpoint that is not one of the workspace's items keeps
  the mssql edge and is reported as `Fabric Endpoint Not Resolved`
  (`fabric_endpoints_unresolved`); the lakehouse properties failure shares
  that title and counter.
- Datamarts, mirrored databases and SQL databases are deliberately left
  out: the OneLake connector does not ingest their tables, so an edge to
  them would be phantom lineage (a datamart also exposes no endpoint id to
  a service principal).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- A swapped OneLake upstream bypasses the dataset_type_mapping filter
  (like DirectLake lineage), so a narrowed mapping that let the mssql edge
  through no longer turns it into no edge at all.
- A display name shared by several Lakehouses/Warehouses is reported as
  `Fabric Endpoint Name Ambiguous` and keeps the mssql edge instead of
  guessing; ids are collected across all name matches.
- Native `[Query=...]` over an endpoint host now gets references from the
  parsed table names and is swapped too; `Sql.Databases` navigations and
  navigations without an Item are reported as `Fabric Endpoint M Shape
  Unsupported` instead of silently keeping an mssql edge. An endpoint
  behind an unresolved dataset parameter still falls through (documented).
- Counters split: `fabric_lakehouse_endpoints_unresolved` (API side) vs
  `fabric_endpoint_references_unresolved` / `_ambiguous` (mapper side),
  plus `fabric_endpoint_m_shapes_unsupported`.
- Shared `_onelake_platform_detail`, extracted warning helper, dropped the
  dead env fallback (resolvers always return an env).
- Docs: breaking-change note (both metadata modes, edges rewritten in
  place, nothing deleted) and the URN casing rule against the OneLake
  connector.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… too

A Dataflow Gen2 entity whose query reads a Fabric SQL analytics endpoint
kept a generic mssql edge while the same query on a semantic-model table
was mapped to the OneLake table. extract_dataflow_entity_lineage now
takes the workspace and resolves endpoint references before mapping the
upstreams. Docs note that these OneLake edges bypass dataset_type_mapping
(as DirectLake does) and the breaking-change entry carries a PR
placeholder.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ineage

Give the warehouse-model fixture a refresh schedule answer, recount the
report counters with every feature of the stack on, regenerate the
workspace_apis goldens, and pin that a Fabric endpoint swap keeps the
sourceColumn column lineage of a field the model renamed on the OneLake URN.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…set_type_mapping

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

PR Summary

Overview
Power BI ingestion now rewrites upstream lineage for semantic-model tables and Dataflow Gen2 entities whose M queries hit a Microsoft Fabric SQL analytics endpoint (Sql.Database("…datawarehouse.fabric.microsoft.com", …)), including native [Query=…] SQL. The mapper resolves the endpoint to the workspace’s Lakehouse or Warehouse and emits edges to fabric-onelake URNs (aligned with the OneLake connector) instead of generic mssql datasets.

Registration and resolution list Fabric items, fetch lakehouse SQL endpoint properties (and warehouse connection strings when needed), track endpoint hosts for display-name matching, and warn on unresolved, ambiguous, or unsupported M shapes (Sql.Databases, missing Item, etc.); unmatched queries keep the mssql edge. Swapped OneLake edges are from_fabric_endpoint so they are not dropped by a narrowed dataset_type_mapping, like existing DirectLake lineage. Column renames during lineage processing now preserve fabric_endpoint_references via dataclasses.replace.

Docs add a breaking-change note and a Power BI source section on Fabric Lakehouse/Warehouse lineage; new reporter counters and broad unit/integration coverage exercise warehouse import and DirectLake cases.

Reviewed by Cursor Bugbot for commit e39e702. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

…nameColumns

Rebuilding Lineage field by field after renames dropped
fabric_endpoint_references, so a Sql.Database navigation followed by
Table.RenameColumns kept its mssql upstream instead of the OneLake table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 15 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

- A display-name match only counts on the workspace's own endpoint host
  when that host is known (read from lakehouse properties), so a query on
  another workspace's endpoint is not linked to a same-named local item.
- A lakehouse whose properties name no SQL endpoint is counted and warned
  instead of dropped silently.
- A Fabric endpoint navigation that resolves no table is reported as an
  unsupported shape.
- Native-query tables with a dot in their bracketed name are split by
  anchoring on the connected database instead of the last three segments.
- Ambiguous and unresolved endpoint warnings fire once per table, like
  their counters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cc39c37. Configure here.

…ql names

Anchoring the split on the connected database misread a platform
instance of the same name as the database. The instance the URN was
built with is now stripped first; database and schema are the next two
segments and the rest is the table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 8 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

…paces

Display-name matches for Sql.Database queries are only scoped to the
workspace's endpoint host when that host is known. Warehouse-only
workspaces now record it from one warehouse properties call, and the docs
state that admin_scan reports no host. Adds a test that id matches are
unaffected by the host check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 8 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

…oint fails

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview — e39e702a Deployed Dec 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Issues and Improvements to docs ingestion PR or Issue related to the ingestion of metadata

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant